package locale;

import anaydis.sort.Sorter;
import anaydis.sort.gui.ObservableSorter;
import benchMark.BenchMarkImpl;
import data.IntegerDataSetGenerator;
import impl.AbstractSorter;
import impl.HeapSorter;
import provider.SorterProviderImpl;

import javax.swing.plaf.synth.SynthTextAreaUI;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
 * Created by IntelliJ IDEA.
 * User: Kevin Stessens
 * Date: 25/10/11
 * Time: 19:03
 * To change this template use File | Settings | File Templates.
 */
public class OrdenarConLocale {

    public static void main(String[] args) {
        IntegerDataSetGenerator dataGenerator = new IntegerDataSetGenerator();
        SorterProviderImpl sorterProvider = new SorterProviderImpl();
        HeapSorter sorter = new HeapSorter();
        algorithmTest(dataGenerator, sorter);
    }

    private static void algorithmTest(IntegerDataSetGenerator dataGenerator, HeapSorter sorters) {
        System.out.println("Resultado de las pruebas de HeapSort:");
        System.out.println("");
        randomTesting(dataGenerator, sorters);
    }

    private static void randomTesting(IntegerDataSetGenerator dataGenerator, HeapSorter sorter) {
        List palabras = new ArrayList();
        palabras.add("llamado");
        palabras.add("lunes");
        palabras.add("péché");
        palabras.add("pêche");
        palabras.add("cerca");
        palabras.add("champán");
        palabras.add("clamor");
        List list2 = palabras;
        BenchMarkImpl benchMark = new BenchMarkImpl();
        sorter.addSorterListener(benchMark);
        sorter.sort(Locale.FRENCH, dataGenerator.getComparator(), palabras);
        System.out.println("Palabras ordenadas con Locale FRENCH");
        show(list2);
        sorter.sort(Locale.ENGLISH, dataGenerator.getComparator(), palabras);
        System.out.println("Palabras ordenadas con Locale ENGLISH");
        show(list2);
        sorter.sort(Locale.forLanguageTag("ES"), dataGenerator.getComparator(), palabras);
        System.out.println("Palabras ordenadas con Locale ESPAÑOL");
        show(list2);
    }

    private static void show(List list) {
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

    }

}



